#ifndef GPIO_H
#define GPIO_H

/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
#include "delay.h"

/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/  
#define KEY_UP_PORT				GPIOA
#define KEY_UP_PIN				GPIO_Pin_0
#define KEY_UP_CLK				RCC_APB2Periph_GPIOA

#define KEY_DOWN_PORT			GPIOE
#define KEY_DOWN_PIN			GPIO_Pin_3
#define KEY_DOWN_CLK			RCC_APB2Periph_GPIOE

#define KEY_PRESS				0
#define KEY_RELEASE				1

/* Exported macro ------------------------------------------------------------*/
#define KEY_UP_IN()				GPIO_ReadInputDataBit(KEY_UP_PORT, KEY_UP_PIN)
#define KEY_DOWN_IN()			GPIO_ReadInputDataBit(KEY_DOWN_PORT, KEY_DOWN_PIN)


/* Exported variables ---------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void key_init(void);
uint8_t key_scan(void);


#endif

